package com.icode.core.model.house;

import com.icode.core.model.AbstractEntity;
import com.icode.core.model.house.MyHouse;

import javax.persistence.*;

/**
 * Created with IntelliJ IDEA.
 * User: sunk
 * Date: 15-11-15
 * Time: 下午9:45
 * To change this template use File | Settings | File Templates.
 */
@Entity
@Table(name = "assignment")
public class Assignment extends AbstractEntity {
    @OneToOne
    @JoinColumn(name = "my_house_id")
    private MyHouse myHouse;

    private String description;

    @Column(name = "status")
    @Enumerated(EnumType.STRING)
    private MyHouseStatus myHouseStatus;

    @ManyToOne
    @JoinColumn(name = "assigner_id")
    private MyHouse assigner;

    public Assignment() {
    }
    public Assignment(MyHouse myHouse) {
        this.myHouse = myHouse;
    }

    public Assignment(MyHouse myHouse, String description) {
        this.myHouse = myHouse;
        this.description = description;
    }

    public MyHouse myHouse() {
        return myHouse;
    }

    public String description() {
        return description;
    }

    public MyHouseStatus myHouseStatus() {
        return myHouseStatus;
    }

    public void updateStatus(MyHouseStatus status) {
        this.myHouseStatus = status;
    }

    public void updateActive(boolean isActive) {
        super.updateActive(isActive);
    }
}
